﻿using System;
using NUnit.Framework;
using NUnit.Framework.Constraints;

namespace Dgg.LearnYourTools.NUnit.C_Assertions.d_Chaining
{
	[TestFixture]
	public class _024_SemanticChaining
	{
		[Test]
		public void SemanticChain()
		{
			Predicate<int> evenPredicate = i => i % 2 == 0;
			Constraint positiveConstraint = new GreaterThanConstraint(0);

			Assert.That(new[] { 2, 4, 6, 8 }, Has.All.LessThanOrEqualTo(10)
				.And.All.Matches(evenPredicate)
				.And.All.Matches(positiveConstraint)
				.And.Some.EqualTo(40));
		}
	}
}
